
/* base directory goes here */
%let gdir = ;

%let codedir = &gdir./codeSAS;
%let logdir = &gdir./logSAS;
%let outdir = &gdir./out;
%let indir = &gdir./in;
%let logdir = &gdir./logSAS;

/* password and user name omitted. They go here. */
%let pwd = ;
%let uid = ;

libname rlib "&gdir./dataSAS";

%let tmpdir = /home/gpfrb/junk;
	
proc datasets lib = work
	kill;
run;
	




/****************************************************************
*																*
*						Load the macros							*
*																*
****************************************************************/

%include "&codedir/get_f941.sas";
%include "&codedir/get_industry.sas";
%include "&codedir/do_merge.sas";

%include "&codedir/get_receipts.sas";

%include "&codedir/get_amendments.sas";
%include "&codedir/get_ind_owners.sas";
%include "&codedir/get_links.sas";
%include "&codedir/solve_owners.sas";
%include "&codedir/get_income.sas";
%include "&codedir/export_result.sas";
%include "&codedir/get_zips.sas";
%include "&codedir/get_employees.sas";
%include "&codedir/get_empl_incm.sas";
%include "&codedir/empl_incm_disn.sas";

%include "&codedir/get_ppp.sas";
%include "&codedir/ppp_summary.sas";
/****************************************************************
*																*
*						Run the macros							*
*																*
****************************************************************/


%get_f941;
%get_industry;


%get_receipts(form=f1120);
%get_receipts(form=f1120s);
%get_receipts(form=f1065);
%get_receipts(form=sched_c);
%get_zips;

%get_amendments;



%get_ppp;

/****************************************************
*													*
*				Get income distribution				*
*													*
****************************************************/




/****************************
*	Get individual owners	*
****************************/

%get_sched_c_owners;
%get_s_corp_owners;
%get_partnership_owners;
%get_c_corp_owners;
%assemble_owners;

/****************
*	Get edges	*
****************/

%get_f851;
%get_sched_g;
%get_f1065_k1;
%assemble_links;

/************
*	Trace	*
************/

%solve_owners;
%get_income;
/****************************
*		Employee income		*
****************************/


%get_employees;
%get_empl_incm;
%empl_incm_disn;

/************************************
*									*
*		Final merge and export		*
*									*
************************************/



%do_merge;
%export_result(dtaname=result);
%export_result(dtaname=amendments);
%export_result(dtaname=owner_incm);

%export_result(dtaname=empl_capped_wgt);
%export_result(dtaname=empl_wg_wgt);
%export_result(dtaname=empl_even_wgt);

/********************************
*		Describe PPP match		*
********************************/
%ppp_summary;
